home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 007.FracApp.cpt / FracApp.r < prev    next >
Text File  |  1988-08-01  |  22KB  |  707 lines

  1. /*----------------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MacApp Color QuickDraw Fractal Sample Application
  6. #
  7. #    FracApp
  8. #
  9. #    MFracApp.r    -    Rez Source
  10. #
  11. #    Copyright © 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    8/88
  15. #
  16. #    Components:    MFracApp.p            August 1, 1988
  17. #                UFracApp.p            August 1, 1988
  18. #                UFracApp.inc1.p        August 1, 1988
  19. #                FracApp.r            August 1, 1988
  20. #                FracApp.make        August 1, 1988
  21. #
  22. #    This is a program to calculate the Mandelbrot set, allowing you to zoom in on areas
  23. #    that are selected with the mouse.  There are some special color tricks played
  24. #    in order to make the program more jazzy.  A special color table is used to give
  25. #    smooth transitions from one color to the next.  Color table animation is also
  26. #    supported, for the wowem effect of flowing Mandelbrot images. 
  27. #    The program is written in MacApp 1.1, which explains why it has a real user
  28. #    interface.  Mandelbrot images take about 30 minutes to calculate.  It is
  29. #    Juggler aware so you can put the program in the background where it will
  30. #    continue to calculate, while you do something more important, like look at 
  31. #    the source code.  It also handles multiple documents, and reading/writing of
  32. #    PICT files using the bottlenecks to minimize the memory hit.
  33. #    
  34. #    This program is intended to be a real world example of handling color in a
  35. #    nontrivial fashion.  As such it has some rather special color requirements,
  36. #    and those don’t match the current system architecture very well.  The program
  37. #    is designed to be compatible with the future, it will not break in future
  38. #    systems.  However, it does not use the Palette Manager, which means that
  39. #    there will be situations where the colors will not look right in either FracApp
  40. #    or another program running under MultiFinder.  The approach that FracApp
  41. #    uses is thus not the preferred Apple approach and does NOT have the Apple
  42. #    seal of approval from engineering.  The only way to get the stamp of approval
  43. #    is to use the Palette Manager.  To do a program of this form, you cannot
  44. #    use the Palette Manager without some extra hacks that are compatibility
  45. #    risks in themselves.  So... use at your own risk.  If you are forced to revise your 
  46. #    program because you followed this as an example, you cannot gripe to Apple, since
  47. #    it is not fully approved.  You just have to change your program, which I hope is no
  48. #    big deal.  You can give this code to other people, as long as they recognize
  49. #    that it is not fully approved too. 
  50. #    
  51. #    Unless you have very special color requirements, you should use the Palette 
  52. #    Manager.  It works for most things, and is much easier to use than the
  53. #    approach taken here.  There are a few things it won’t do of course, leading
  54. #    to this code.  If you can do it, use the Palette Manager and save yourself
  55. #    some grief.
  56. #            Written in MacApp Object Pascal code.
  57. #            Compatibility rating = 2.  (nothing will break, but it may not
  58. #                always look correct.)
  59. #
  60. ----------------------------------------------------------------------------------------*/
  61. /* Copyright 1988 by Bob. */
  62. /* February 1, 1988 */
  63. /*    Written by Bo3b Johnson of Developer Technical Support. */
  64.  
  65. #ifdef Debugging
  66. include MacAppRFiles"Debug.rsrc";
  67. #endif
  68. include MacAppRFiles"MacApp.rsrc";
  69. include MacAppRFiles"Printing.rsrc";
  70.  
  71. include "FracApp" 'CODE';
  72.  
  73. resource 'WIND' (1001, purgeable) {
  74.     {50, 20, 200, 450},
  75.     zoomDocProc,
  76.     invisible,
  77.     goAway,
  78.     0x0,
  79.     "<<<>>>"
  80. };
  81.  
  82.  
  83. /* The brave new approach.  This will be the clut resource that we use to do the color
  84.     table for the offscreen bitmap.  This is a set of colors that we specifically want
  85.     in our bitmap, the only ones that we use. This table has all the artificial requirements
  86.     that a color table normally has, like having white first, black last. This color 
  87.     table is the one really desired for the actual fractals, so it will be used only 
  88.     for the offscreen map.  Resource Id is to be in 0..1023 to start with, since it will
  89.     become the initial ctSeed number.  This is currently done as straight hex since
  90.     I cannot stand the incredibly stupid rez syntax and refuse to waste my time
  91.     programming rez when I really want to be programming FracApp. */
  92.  
  93. data 'clut' (501, preload, nonpurgeable) {
  94.     $"0000 0000 8000 00FF"            /* 256 total colors used */
  95.  
  96.         /* Now the actual colors in the table.  The values are overwritten by color QD
  97.             when needed, but are added here, just to keep this data straight. */
  98.     $"0000 FFFF FFFF FFFF"            /* first color must be white of course. */
  99.     $"0001 FFFF 0000 0000"
  100.     $"0002 FFFF 0400 0000"
  101.     $"0003 FFFF 0800 0000"
  102.     $"0004 FFFF 0C00 0000"
  103.     $"0005 FFFF 1000 0000"
  104.     $"0006 FFFF 1400 0000"
  105.     $"0007 FFFF 1800 0000"
  106.     $"0008 FFFF 1C00 0000"
  107.     $"0009 FFFF 2000 0000"
  108.     $"000A FFFF 2400 0000"
  109.     $"000B FFFF 2800 0000"
  110.     $"000C FFFF 2C00 0000"
  111.     $"000D FFFF 3000 0000"
  112.     $"000E FFFF 3400 0000"
  113.     $"000F FFFF 3800 0000"
  114.     $"0010 FFFF 3C00 0000"
  115.     $"0011 FFFF 4000 0000"
  116.     $"0012 FFFF 4400 0000"
  117.     $"0013 FFFF 4800 0000"
  118.     $"0014 FFFF 4C00 0000"
  119.     $"0015 FFFF 5000 0000"
  120.     $"0016 FFFF 5400 0000"
  121.     $"0017 FFFF 5800 0000"
  122.     $"0018 FFFF 5C00 0000"
  123.     $"0019 FFFF 6000 0000"
  124.     $"001A FFFF 6400 0000"
  125.     $"001B FFFF 6800 0000"
  126.     $"001C FFFF 6C00 0000"
  127.     $"001D FFFF 7000 0000"
  128.     $"001E FFFF 7400 0000"    /* color 30 of the fixed colors we use. */
  129.     $"001F FFFF 7800 0000"
  130.     $"0020 FFFF 7C00 0000"
  131.     $"0021 FFFF 8000 0000"
  132.     $"0022 FFFF 8400 0000"
  133.     $"0023 FFFF 8800 0000"
  134.     $"0024 FFFF 8C00 0000"
  135.     $"0025 FFFF 9000 0000"
  136.     $"0026 FFFF 9400 0000"
  137.     $"0027 FFFF 9800 0000"
  138.     $"0028 FFFF 9C00 0000"
  139.     $"0029 FFFF A000 0000"
  140.     $"002A FFFF A400 0000"
  141.     $"002B FFFF A800 0000"
  142.     $"002C FFFF AC00 0000"
  143.     $"002D FFFF B000 0000"
  144.     $"002E FFFF B400 0000"
  145.     $"002F FFFF B800 0000"
  146.     $"0030 FFFF BC00 0000"
  147.     $"0031 FFFF C000 0000"
  148.     $"0032 FFFF C400 0000"
  149.     $"0033 FFFF C800 0000"
  150.     $"0034 FFFF CC00 0000"
  151.     $"0035 FFFF D000 0000"
  152.     $"0036 FFFF D400 0000"
  153.     $"0037 FFFF D800 0000"
  154.     $"0038 FFFF DC00 0000"
  155.     $"0039 FFFF E000 0000"
  156.     $"003A FFFF E400 0000"
  157.     $"003B FFFF E800 0000"
  158.     $"003C FFFF EC00 0000"    /* color 60 */
  159.     $"003D FFFF F000 0000"
  160.     $"003E FFFF F400 0000"
  161.     $"003F FFFF F800 0000"
  162.     $"0040 FFFF FC00 0000"
  163.     $"0041 FFFF FFFF 0000"    /* 65 end of first set.  */
  164.     $"0042 0000 FFFF 0000"
  165.     $"0043 0000 FFFF 0400"
  166.     $"0044 0000 FFFF 0800"
  167.     $"0045 0000 FFFF 0C00"
  168.     $"0046 0000 FFFF 1000"
  169.     $"0047 0000 FFFF 1400"
  170.     $"0048 0000 FFFF 1800"
  171.     $"0049 0000 FFFF 1C00"
  172.     $"004A 0000 FFFF 2000"
  173.     $"004B 0000 FFFF 2400"
  174.     $"004C 0000 FFFF 2800"
  175.     $"004D 0000 FFFF 2C00"
  176.     $"004E 0000 FFFF 3000"
  177.     $"004F 0000 FFFF 3400"
  178.     $"0050 0000 FFFF 3800"
  179.     $"0051 0000 FFFF 3C00"
  180.     $"0052 0000 FFFF 4000"
  181.     $"0053 0000 FFFF 4400"
  182.     $"0054 0000 FFFF 4800"
  183.     $"0055 0000 FFFF 4C00"
  184.     $"0056 0000 FFFF 5000"
  185.     $"0057 0000 FFFF 5400"
  186.     $"0058 0000 FFFF 5800"
  187.     $"0059 0000 FFFF 5C00"
  188.     $"005A 0000 FFFF 6000"
  189.     $"005B 0000 FFFF 6400"
  190.     $"005C 0000 FFFF 6800"
  191.     $"005D 0000 FFFF 6C00"
  192.     $"005E 0000 FFFF 7000"
  193.     $"005F 0000 FFFF 7400"
  194.     $"0060 0000 FFFF 7800"
  195.     $"0061 0000 FFFF 7C00"
  196.     $"0062 0000 FFFF 8000"
  197.     $"0063 0000 FFFF 8400"
  198.     $"0064 0000 FFFF 8800"    /* color 100 */
  199.     $"0065 0000 FFFF 8C00"
  200.     $"0066 0000 FFFF 9000"
  201.     $"0067 0000 FFFF 9400"
  202.     $"0068 0000 FFFF 9800"
  203.     $"0069 0000 FFFF 9C00"
  204.     $"006A 0000 FFFF A000"
  205.     $"006B 0000 FFFF A400"
  206.     $"006C 0000 FFFF A800"
  207.     $"006D 0000 FFFF AC00"
  208.     $"006E 0000 FFFF B000"
  209.     $"006F 0000 FFFF B400"
  210.     $"0070 0000 FFFF B800"
  211.     $"0071 0000 FFFF BC00"
  212.     $"0072 0000 FFFF C000"
  213.     $"0073 0000 FFFF C400"
  214.     $"0074 0000 FFFF C800"
  215.     $"0075 0000 FFFF CC00"
  216.     $"0076 0000 FFFF D000"
  217.     $"0077 0000 FFFF D400"
  218.     $"0078 0000 FFFF D800"
  219.     $"0079 0000 FFFF DC00"
  220.     $"007A 0000 FFFF E000"
  221.     $"007B 0000 FFFF E400"
  222.     $"007C 0000 FFFF E800"
  223.     $"007D 0000 FFFF EC00"
  224.     $"007E 0000 FFFF F000"
  225.     $"007F 0000 FFFF F400"
  226.     $"0080 0000 FFFF F800"
  227.     $"0081 0000 FFFF FC00"
  228.     $"0082 0000 FFFF FFFF"    /* 130 end of 2nd set. */
  229.     $"0083 0000 0000 FFFF"
  230.     $"0084 0400 0000 FFFF"
  231.     $"0085 0800 0000 FFFF"
  232.     $"0086 0C00 0000 FFFF"
  233.     $"0087 1000 0000 FFFF"
  234.     $"0088 1400 0000 FFFF"
  235.     $"0089 1800 0000 FFFF"
  236.     $"008A 1C00 0000 FFFF"
  237.     $"008B 2000 0000 FFFF"
  238.     $"008C 2400 0000 FFFF"
  239.     $"008D 2800 0000 FFFF"
  240.     $"008E 2C00 0000 FFFF"
  241.     $"008F 3000 0000 FFFF"
  242.     $"0090 3400 0000 FFFF"
  243.     $"0091 3800 0000 FFFF"
  244.     $"0092 3C00 0000 FFFF"
  245.     $"0093 4000 0000 FFFF"
  246.     $"0094 4400 0000 FFFF"
  247.     $"0095 4800 0000 FFFF"
  248.     $"0096 4C00 0000 FFFF"    /* color 150 */
  249.     $"0097 5000 0000 FFFF"
  250.     $"0098 5400 0000 FFFF"
  251.     $"0099 5800 0000 FFFF"
  252.     $"009A 5C00 0000 FFFF"
  253.     $"009B 6000 0000 FFFF"
  254.     $"009C 6400 0000 FFFF"
  255.     $"009D 6800 0000 FFFF"
  256.     $"009E 6C00 0000 FFFF"
  257.     $"009F 7000 0000 FFFF"
  258.     $"00A0 7400 0000 FFFF"
  259.     $"00A1 7800 0000 FFFF"
  260.     $"00A2 7C00 0000 FFFF"
  261.     $"00A3 8000 0000 FFFF"
  262.     $"00A4 8400 0000 FFFF"
  263.     $"00A5 8800 0000 FFFF"
  264.     $"00A6 8C00 0000 FFFF"
  265.     $"00A7 9000 0000 FFFF"
  266.     $"00A8 9400 0000 FFFF"
  267.     $"00A9 9800 0000 FFFF"
  268.     $"00AA 9C00 0000 FFFF"
  269.     $"00AB A000 0000 FFFF"
  270.     $"00AC A400 0000 FFFF"
  271.     $"00AD A800 0000 FFFF"
  272.     $"00AE AC00 0000 FFFF"
  273.     $"00AF B000 0000 FFFF"    /* color 175 */
  274.     $"00B0 B400 0000 FFFF"
  275.     $"00B1 B800 0000 FFFF"
  276.     $"00B2 BC00 0000 FFFF"
  277.     $"00B3 C000 0000 FFFF"
  278.     $"00B4 C400 0000 FFFF"
  279.     $"00B5 C800 0000 FFFF"
  280.     $"00B6 CC00 0000 FFFF"
  281.     $"00B7 D000 0000 FFFF"
  282.     $"00B8 D400 0000 FFFF"
  283.     $"00B9 D800 0000 FFFF"
  284.     $"00BA DC00 0000 FFFF"
  285.     $"00BB E000 0000 FFFF"
  286.     $"00BC E400 0000 FFFF"
  287.     $"00BD E800 0000 FFFF"
  288.     $"00BE EC00 0000 FFFF"
  289.     $"00BF F000 0000 FFFF"
  290.     $"00C0 F400 0000 FFFF"
  291.     $"00C1 F800 0000 FFFF"
  292.     $"00C2 FC00 0000 FFFF"
  293.     $"00C3 FFFF 0000 FFFF"    /* 195 end of 3rd set. */
  294.  
  295.     /* Since we are blasting the color table, the Palette Manager can’t do as good
  296.         a job as normal.  In order to help him out, we want to add the colors that
  297.         are for the system palette.  With these colors around there will be less
  298.         problems with color matching, and specifically the Apple Menu will appear
  299.         correctly.  These colors will be forced into the color table as well, but
  300.         they won’t be animated and will still be available for drawing (unlike the
  301.         colors used in the fractals. */
  302.         
  303.     $"00C4 FC00 F37D 052F"    /* next 14 entries from system palette */
  304.     $"00C5 FFFF 648A 028C"
  305.     $"00C6 DD6B 08C2 06A2"    /* they are always there. */
  306.     $"00C7 F2D7 0856 84EC"
  307.     $"00C8 46E3 0000 A53E"
  308.     $"00C9 0000 0000 D400"
  309.     $"00CA 0241 AB54 EAFF"
  310.     $"00CB 1F21 B793 1431"
  311.     $"00CC 0000 64AF 11B0"
  312.     $"00CD 5600 2C9D 0524"
  313.     $"00CE 90D7 7160 3A34"
  314.     $"00CF C000 C000 C000"
  315.     $"00D0 8000 8000 8000"
  316.     $"00D1 4000 4000 4000"
  317.  
  318.     /* Now we have filler colors for the offscreen color table.  These are never
  319.         used, but have to be here in order to ensure that the color table this becomes
  320.         is a valid one from the color QD perspective.  If that code hates it, we will
  321.         too.  This will fill the table out to be a full 256 colors. *** needed? */
  322.     $"00D2 AAAA 5555 AAAA"    /* a weird number to set it apart, easier debugging. */
  323.     $"00D3 AAAA 5555 AAAA"
  324.     $"00D4 AAAA 5555 AAAA"
  325.     $"00D5 AAAA 5555 AAAA"
  326.     $"00D6 AAAA 5555 AAAA"
  327.     $"00D7 AAAA 5555 AAAA"
  328.     $"00D8 AAAA 5555 AAAA"
  329.     $"00D9 AAAA 5555 AAAA"
  330.     $"00DA AAAA 5555 AAAA"
  331.     $"00DB AAAA 5555 AAAA"
  332.     $"00DC AAAA 5555 AAAA"
  333.     $"00DD AAAA 5555 AAAA"
  334.     $"00DE AAAA 5555 AAAA"
  335.     $"00DF AAAA 5555 AAAA"
  336.     $"00E0 AAAA 5555 AAAA"
  337.     $"00E1 AAAA 5555 AAAA"
  338.     $"00E2 AAAA 5555 AAAA"
  339.     $"00E3 AAAA 5555 AAAA"
  340.     $"00E4 AAAA 5555 AAAA"
  341.     $"00E5 AAAA 5555 AAAA"
  342.     $"00E6 AAAA 5555 AAAA"
  343.     $"00E7 AAAA 5555 AAAA"
  344.     $"00E8 AAAA 5555 AAAA"
  345.     $"00E9 AAAA 5555 AAAA"
  346.     $"00EA AAAA 5555 AAAA"
  347.     $"00EB AAAA 5555 AAAA"
  348.     $"00EC AAAA 5555 AAAA"
  349.     $"00ED AAAA 5555 AAAA"
  350.     $"00EE AAAA 5555 AAAA"
  351.     $"00EF AAAA 5555 AAAA"
  352.     $"00F0 AAAA 5555 AAAA"
  353.     $"00F1 AAAA 5555 AAAA"
  354.     $"00F2 AAAA 5555 AAAA"
  355.     $"00F3 AAAA 5555 AAAA"
  356.     $"00F4 AAAA 5555 AAAA"
  357.     $"00F5 AAAA 5555 AAAA"
  358.     $"00F6 AAAA 5555 AAAA"
  359.     $"00F7 AAAA 5555 AAAA"
  360.     $"00F8 AAAA 5555 AAAA"
  361.     $"00F9 AAAA 5555 AAAA"
  362.     $"00FA AAAA 5555 AAAA"
  363.     $"00FB AAAA 5555 AAAA"
  364.     $"00FC AAAA 5555 AAAA"
  365.     $"00FD AAAA 5555 AAAA"
  366.     $"00FE AAAA 5555 AAAA"
  367.     $"00FF 0000 0000 0000"    /* end of set is black. */
  368. };
  369.  
  370. /* Now a palette that is associated with every window automatically when the
  371.     window is opened.  The resource ID matches that of the window template.  
  372.     This palette is very mellow, just the first 16 colors as the standard
  373.     color palette.  The first 16 colors are there so that
  374.     in lower depths we will use a known set of colors, and while we are
  375.     using known colors we might as well make them ones that will help
  376.     avoid spurious color updates.  This is the system palette. Anybody using 
  377.     the default colors will get these helping them to look better.  This
  378.     palette will have no effect in > kNumColors mode since we blast the 
  379.     colors around. */
  380.     
  381. data 'pltt' (1001, preload, nonpurgeable) {
  382.     $"000F 0000 0000 0000 0000 0000 0000 0000"    /* 16 colors in table. */
  383.     $"FFFF FFFF FFFF 0000 0000 0000 0000 0000"    /* white as first guy. */
  384.     $"0000 0000 0000 0000 0000 0000 0000 0000"    /* black as second */
  385.     $"FC00 F37D 052F 0002 0000 0000 0000 0000"    /* next 14 entries from system palette */
  386.     $"FFFF 648A 028C 0002 0000 0000 0000 0000"    /* all set as tolerant 0 to ensure */
  387.     $"DD6B 08C2 06A2 0002 0000 0000 0000 0000"    /* they are always there. */
  388.     $"F2D7 0856 84EC 0002 0000 0000 0000 0000"
  389.     $"46E3 0000 A53E 0002 0000 0000 0000 0000"
  390.     $"0000 0000 D400 0002 0000 0000 0000 0000"
  391.     $"0241 AB54 EAFF 0002 0000 0000 0000 0000"
  392.     $"1F21 B793 1431 0002 0000 0000 0000 0000"
  393.     $"0000 64AF 11B0 0002 0000 0000 0000 0000"
  394.     $"5600 2C9D 0524 0002 0000 0000 0000 0000"
  395.     $"90D7 7160 3A34 0002 0000 0000 0000 0000"
  396.     $"C000 C000 C000 0002 0000 0000 0000 0000"
  397.     $"8000 8000 8000 0002 0000 0000 0000 0000"
  398.     $"4000 4000 4000 0002 0000 0000 0000 0000"
  399. };
  400.  
  401.  
  402. /* we put the latest SIZE template here so we can rez with MPW 2.0 */
  403.  
  404. type 'SIZE' {
  405.         boolean        dontSaveScreen,
  406.                     saveScreen;
  407.         boolean     ignoreSuspendResumeEvents,
  408.                     acceptSuspendResumeEvents;
  409.         boolean        enableOptionSwitch,
  410.                     disableOptionSwitch;
  411.         boolean        cannotBackground,
  412.                     canBackground;
  413.         boolean        notMultiFinderAware,
  414.                     multiFinderAware;
  415.         boolean        notOnlyBackground,
  416.                     onlyBackground;
  417.         boolean        dontGetFrontClicks,
  418.                     getFrontClicks;
  419.         unsigned bitstring[9] = 0;
  420.         unsigned longint;    /* preferred memory size in bytes */
  421.         unsigned longint;    /* minimum memory size in bytes */
  422. };    /* ignore the warning caused by re-defining SIZE */
  423.  
  424.  
  425. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  426.  
  427. resource 'SIZE' (-1) {
  428.     saveScreen,
  429.     acceptSuspendResumeEvents,
  430.     disableOptionSwitch,
  431.     canBackground,
  432.     multiFinderAware,    /* this says we do our own activate/deactivate; don't fake us out */
  433.     notOnlyBackground,    /* this is definitely not a background-only application! */
  434.     dontGetFrontClicks,    /* change this is if you want "do first click" behavior like the Finder */
  435. #ifdef Debugging
  436.     1050 * 1024,
  437.     500 * 1024
  438. #else
  439.     1050 * 1024,
  440.     420 * 1024
  441. #endif
  442. };
  443.  
  444. resource 'DITL' (201, purgeable) {
  445.     {    /* array DITLarray: 3 elements */
  446.         /* [1] */
  447.         {145, 182, 165, 262},
  448.         Button {
  449.             enabled,
  450.             "OK, OK."
  451.         },
  452.         /* [2] */
  453.         {10, 80, 133, 304},
  454.         StaticText {
  455.             disabled,
  456.             "FracApp, version 1.0 by Bo3b Johnson.  Calculates the Mandelbrot "
  457.             "set using direct 68881 code for maximum speed.  Color table "
  458.             "animation and color mapping for effect.  Select an area with "
  459.             "the mouse to zoom in."
  460.         },
  461.         /* [3] */
  462.         {10, 20, 42, 52},
  463.         Icon {
  464.             disabled,
  465.             201
  466.         }
  467.     }
  468. };
  469.  
  470. resource 'ALRT' (201, purgeable) {
  471.     {90, 100, 270, 412},
  472.     201,
  473.     {
  474.         OK, visible, silent;
  475.         OK, visible, silent;
  476.         OK, visible, silent;
  477.         OK, visible, silent
  478.     }
  479. };
  480.  
  481. /* The icon used in the about box.  The same as the program ICN#, but ICON instead. */
  482. resource 'ICON' (201, purgeable) {
  483.         $"0000 0001 0000 0002 0000 0004 0040 0018 0020 0418 001C 03E0 001C 03E0 001F FFE0"
  484.         $"0007 FFE0 0007 FFE0 0007 FF90 0007 FF80 FFFF FF80 FFFF FF80 DFFF FF80 EFFF FF80"
  485.         $"F1FF FF80 F1FF FF80 F1FF FFE0 FE07 FFE0 FE07 C0E0 FE07 8050 FE07 3028 FE01 C810"
  486.         $"FE0E 7F8F FFE2 3007 FFFF 0007 FFFF 8007 FFFF E007 FFFF FFE7 FFFF F01F FFFF F007"
  487. };
  488.  
  489. /* For the menus, except the Apple menu, we set the enable flags to zero for 
  490.     simplicity.   The right pieces will get enabled by the MacApp handlers (DoSetUpMenus
  491.     for whatever object can do it), so we'll start with disabled. */
  492. resource 'cmnu' (1) {
  493.     1,
  494.     textMenuProc,
  495.     0x7FFFFFFD,
  496.     enabled,
  497.     apple,
  498.      {    /* array: 2 elements */
  499.         /* [1] */
  500.         "About FracApp…", noIcon, noKey, noMark, plain, cAboutApp;
  501.         /* [2] */
  502.         "-", noIcon, noKey, noMark, plain, nocommand
  503.     }
  504. };
  505.  
  506. resource 'cmnu' (2) {
  507.     2,
  508.     textMenuProc,
  509.     0x0,
  510.     enabled,
  511.     "File",
  512.      {    /* array: 12 elements */
  513.         /* [1] */
  514.         "New", noIcon, "N", noMark, plain, cNew;
  515.         /* [2] */
  516.         "Open…", noIcon, "O", noMark, plain, cOpen;
  517.         /* [3] */
  518.         "-", noIcon, noKey, noMark, plain, nocommand;
  519.         /* [4] */
  520.         "Close", noIcon, "W", noMark, plain, cClose;
  521.         /* [5] */
  522.         "Save", noIcon, "S", noMark, plain, cSave;
  523.         /* [6] */
  524.         "Save As…", noIcon, noKey, noMark, plain, cSaveAs;
  525.         /* [7] */
  526.         "Save a Copy In…", noIcon, noKey, noMark, plain, cSaveCopy;
  527.         /* [8] */
  528.         "-", noIcon, noKey, noMark, plain, nocommand;
  529.         /* [9] */
  530.         "Quit", noIcon, "Q", noMark, plain, cQuit
  531.     }
  532. };
  533.  
  534. resource 'cmnu' (3) {
  535.     3,
  536.     textMenuProc,
  537.     0x0,
  538.     enabled,
  539.     "Edit",
  540.      {    /* array: 8 elements */
  541.         /* [1] */
  542.         "Undo", noIcon, "Z", noMark, plain, cUndo;
  543.         /* [2] */
  544.         "-", noIcon, noKey, noMark, plain, nocommand;
  545.         /* [3] */
  546.         "Cut", noIcon, "X", noMark, plain, cCut;
  547.         /* [4] */
  548.         "Copy", noIcon, "C", noMark, plain, cCopy;
  549.         /* [5] */
  550.         "Paste", noIcon, "V", noMark, plain, cPaste;
  551.         /* [6] */
  552.         "Clear", noIcon, noKey, noMark, plain, cClear;
  553.         /* [7] */
  554.         "-", noIcon, noKey, noMark, plain, nocommand;
  555.         /* [8] */
  556.         "Show Clipboard", noIcon, noKey, noMark, plain, cShowClipboard
  557.     }
  558. };
  559.  
  560. resource 'cmnu' (4) {
  561.     4,
  562.     textMenuProc,
  563.     0x0,
  564.     enabled,
  565.     "Zoomy",
  566.      {    /* array: 1 elements */
  567.         /* [1] */
  568.         "New from selection", noIcon, noKey, noMark, plain, 1000;
  569.         /* [2] */
  570.         "-", noIcon, noKey, noMark, plain, nocommand;
  571.         /* [3] */
  572.         "Rotate Colors", noIcon, noKey, noMark, plain, 1001
  573.     }
  574. };
  575.  
  576. resource 'MBAR' (128) {
  577.     {1; 2; 3; 4}
  578. };
  579.  
  580.  
  581. /* Now the pattern that is used for the selection rectangle. */
  582.  
  583. resource 'PAT ' (128, preload, nonpurgeable) {
  584.     $"FCF9 F3E7 CF9F 3F7E"
  585. };
  586.  
  587.  
  588. /* list mapping of our error code to the info string. */
  589.  
  590. resource 'errs' (1128, purgeable) {
  591.     {    whichList, 0, 1100;
  592.         1000, 1000, 1;                        /* error code if wrong machine, crash avoidance. */
  593.         -152, -151, 3                        /* translate Color Manager error to out of mem. */
  594.     }
  595. };
  596.  
  597. /* The info strings for our errors.   The first is for special handling on the
  598.     init when we have a computer where we would crash, the second is to
  599.     handle the color animation failing in a place where we can't give use
  600.     a normal error string. */
  601.  
  602. resource 'STR#' (1100, purgeable) {
  603.     {    /* [1] */    "Color QuickDraw, a 68881 (FPU), and the latest System "
  604.                         "are required";
  605.         /* [2] */    "continue rotating colors";
  606.         /* [3] */    "there is not enough memory"
  607.     }
  608. };
  609.  
  610.  
  611.     /* Now all the baggage required for the Icons at the Finder.  No real
  612.         program keeps the default Icon.  Herein is the BNDL, Arf , ICN#, FREF
  613.         resources required. The 'Arf ' is the application type.  Registered
  614.         of course. */
  615.         
  616. resource 'ICN#' (128) {
  617.     {    /* array: 2 elements */
  618.         /* [1] */
  619.         $"0000 0001 0000 0002 0000 0004 0040 0018 0020 0418 001C 03E0 001C 03E0 001F FFE0"
  620.         $"0007 FFE0 0007 FFE0 0007 FF90 0007 FF80 FFFF FF80 FFFF FF80 DFFF FF80 EFFF FF80"
  621.         $"F1FF FF80 F1FF FF80 F1FF FFE0 FE07 FFE0 FE07 C0E0 FE07 8050 FE07 3028 FE01 C810"
  622.         $"FE0E 7F8F FFE2 3007 FFFF 0007 FFFF 8007 FFFF E007 FFFF FFE7 FFFF F01F FFFF F007",
  623.         /* [2] */
  624.         $"0000 0001 0000 0002 0000 0004 0040 0018 0020 0418 001C 03E0 001C 03E0 001F FFE0"
  625.         $"0007 FFE0 0007 FFE0 0007 FF90 0007 FF80 FFFF FF80 FFFF FF80 FFFF FF80 FFFF FF80"
  626.         $"FFFF FF80 FFFF FF80 FFFF FFE0 FFFF FFE0 FFFF FFE0 FFFF FFF0 FFFF FFF8 FFFF FFF0"
  627.         $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF F01F FFFF F007"
  628.     }
  629. };
  630.  
  631. resource 'ICN#' (129) {
  632.     {    /* array: 2 elements */
  633.         /* [1] */
  634.         $"0FFF FC00 0C00 0200 0A00 0100 0980 0080 0982 0040 087C 03A0 087C 0390 087F FF90"
  635.         $"087F FE10 087F FE10 089F FE10 081F FE10 081F FFF0 081F FFF0 081F FFF0 081F FFF0"
  636.         $"081F FFF0 081F FFF0 087F FFF0 0870 FFF0 0870 FFF0 0880 FFF0 0900 FFF0 0800 FFF0"
  637.         $"0800 FFF0 0800 FFF0 0800 FFF0 0800 FFF0 0800 FFF0 0800 FFF0 0800 FFF0 0FFF FFF0",
  638.         /* [2] */
  639.         $"0FFF FC00 0FFF FE00 0FFF FF00 0FFF FF80 0FFF FFC0 0FFF FFE0 0FFF FFF0 0FFF FFF0"
  640.         $"0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0"
  641.         $"0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0"
  642.         $"0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0 0FFF FFF0"
  643.     }
  644. };
  645.  
  646. resource 'BNDL' (128) {
  647.     'Arf ',
  648.     0,
  649.     {    /* array TypeArray: 2 elements */
  650.         /* [1] */
  651.         'ICN#',
  652.         {    /* array IDArray: 2 elements */
  653.             /* [1] */
  654.             0, 128,
  655.             /* [2] */
  656.             1, 129
  657.         },
  658.         /* [2] */
  659.         'FREF',
  660.         {    /* array IDArray: 2 elements */
  661.             /* [1] */
  662.             0, 128,
  663.             /* [2] */
  664.             1, 129
  665.         }
  666.     }
  667. };
  668.  
  669. resource 'FREF' (128) {
  670.     'APPL',
  671.     0,
  672.     ""
  673. };
  674.  
  675. resource 'FREF' (129) {
  676.     'PICT',
  677.     1,
  678.     ""
  679. };
  680.  
  681.  
  682. type 'Arf ' as 'STR ';
  683.  
  684. resource  'Arf ' (0) {
  685.     "FracApp version 1.0"        /* the ID string as part of Bundle. */
  686. };
  687.  
  688.  
  689. /* The mem! resource that MacApp uses to know how much more space we need to
  690.    reserve.  We reserve a big old 40K just for fun, so we don't have to narrow
  691.    down the memory useage too closely.  This is big enough to cut us slack 
  692.    during the big picture playbacks.  A little wasteful.  We aren't currently
  693.    using the low space reserve, since we don't have many commands to implement.
  694.    Our memory useage comes in big hunks so it is not as useful to watch for
  695.    crossing a low memory barrier.  We tend to run out completely or not at
  696.    all. We could check the space is low before allowing the new fractal
  697.    operations, but currently it will fail during the allocation and let
  698.    the user know.  Somewhat less friendly, but adequate.   The 40K number
  699.    was found heuristically by examing the heap with TMon to see how
  700.    big the code blocks are.  */
  701.  
  702. resource 'mem!' (1000) {
  703.         40000,        /* code reserve size */
  704.         0,            /* low space reserve size */
  705.         0            /* stack size */
  706. };
  707.